package com.zang.stackqueue;

import java.util.Deque;
import java.util.LinkedList;

/**
 * @author ZVerify
 * @since 2022/10/18 19:36
 * @see <a href="https://leetcode.cn/problems/implement-stack-using-queues/">...</a>
 **/
public class 用队列模拟栈 {

    Deque<Integer> firstDeque;
    Deque<Integer> lastDeque;

    public 用队列模拟栈() {

        firstDeque = new LinkedList<>();
        lastDeque = new LinkedList<>();
    }

    public void push(int x) {

        firstDeque.push(x);
    }

    public int pop() {
      return   firstDeque.pollFirst();
    }

    public int top() {
       return  firstDeque.peekFirst();
    }

    public boolean empty() {
        return firstDeque.isEmpty();
    }
}
